<?php

class Admin_RegisterController extends ExtLb_Controller_Action
{

	private $registerTbl;
	
	
    public function init()
    {
        $this->loadCss('admin', 'register', FOLDER_ROOT_NAME);
        $this->loadLayout('admin', 'layout');
        
        $this->registerTbl	= new Admin_Model_Register();
    }

    public function indexAction()
    {
    	$selectRegister	= $this->registerTbl->selectRegister();
        $paginatorRegister	= new  Zend_Paginator(new Zend_Paginator_Adapter_DbSelect($selectRegister));
        $paginatorRegister->setItemCountPerPage(20)
        				->setPageRange(3)
        				->setCurrentPageNumber($this->_getParam('page',1));
        				
        $this->view->paginatorRegister	= $paginatorRegister;
    }
    
    public function detailAction(){
    	if(isset($_GET['khach']) && !empty($_GET['khach']) && isset($_GET['dv']) && !empty($_GET['dv'])){
			$register = $this->registerTbl
    						->selectRegister("dk.khachId =".$_GET['khach']." and dk.menu2Id =".$_GET['dv']);
    		
    		$registerInfo = array();
    		foreach ($register->query()->fetchAll() as $value) {
    			$registerInfo = $value;
    		}

    		$this->view->registerInfos = $registerInfo;
    	}
    }

}

